package edu.osu.cse.c651.cryptochess;

import android.widget.ImageView;

/**
 * This container is used by BoardController and GameActivity for easy access
 * and modification of the squares of the chess board (on the user interface).
 * 
 * @author Team Pawned
 * 
 */
public class SquareContainer {

	/**
	 * the row of the square that this SquareContainer is accessing and
	 * modifying
	 */
	private int x;

	/**
	 * the column of the square that this SquareContainer is accessing and
	 * modifying
	 */
	private int y;

	/**
	 * the ImageView of this SquareContainer that is altered in order to alter
	 * the square that this SquareContainer is representing.
	 */
	private ImageView square = null;

	/**
	 * Constructor
	 * 
	 * @param x
	 *            the row of the square that this SquareContainer is
	 *            representing
	 * @param y
	 *            the column of the square that this SquareContainer is
	 *            representing
	 * @param square
	 *            the ImageView that represents the square's appearance
	 */
	public SquareContainer(int x, int y, ImageView square) {
		this.x = x;
		this.y = y;
		this.square = square;
	}

	/**
	 * Set the image of this SquareContainer (which will then set the appearance
	 * of the square on the board)
	 * 
	 * @param imgID
	 */
	public void setImage(int imgID) {
		square.setImageResource(imgID);
	}

	/**
	 * Retrieve the ImageView of this SquareContainer
	 * 
	 * @return ImageView the ImageView of this SquareContainer
	 */
	public ImageView getImage() {
		return square;
	}

	/**
	 * The row of this SquareContainer
	 * 
	 * @return int the row of this SquareContainer
	 */
	public int x() {
		return x;
	}

	/**
	 * The column of this SquareContainer
	 * 
	 * @return int the column of this SquareContainer
	 */
	public int y() {
		return y;
	}

}
